package ceyan;
import javax.xml.crypto.Data;
import java.util.LinkedList;
import java.io.*;
public class learn5 {
    public static void main(String[] args) throws IOException {
        //创建文件
        File file=new File("D:\\WUDownloadCache\\90.txt");
        file.createNewFile();
        String str="java";
       Writer writer=new FileWriter(file);
        writer.write(str);
        //二进制读写文件
        FileInputStream fileInputStream=new FileInputStream(file);
        DataInputStream dataInputStream=new DataInputStream(fileInputStream);
        FileOutputStream fileOutputStream=new FileOutputStream("C:\\Intel\\90.txt");
        DataOutputStream dataOutputStream=new DataOutputStream(fileOutputStream);
        byte[] data=str.getBytes();
        dataOutputStream.write(data);
        System.out.println(data);
        dataOutputStream.flush();;
        dataOutputStream.close();
        writer.close();
        //字节流读写字符串二进制文件
        /*File file =new File("D:\\WUDownloadCache\\89.txt");
        file.createNewFile();
        //创建输入流
        FileInputStream fileInputStream=new FileInputStream(file);
        DataInputStream dataInputStream=new DataInputStream(fileInputStream);
        //创建写入流
        FileOutputStream fileOutputStream=new FileOutputStream("C:\\Intel\\89.txt");
        DataOutputStream dataOutputStream=new DataOutputStream(fileOutputStream);
        //读时候要判断
        int data=-1;
        while((data=dataInputStream.read())!=-1){
            dataOutputStream.write((char)data);
            System.out.print((char)data);
        }
        //流写完要关闭
        dataOutputStream.flush();
        dataOutputStream.close();
        fileOutputStream.close();
        dataInputStream.close();
        fileInputStream.close();*/
        /*int j=0;
        int i=0;
        LinkedList list=new LinkedList();
        for( ;i<5;i++){
            j=i;
            list.add(j);
        }
        for(Object r:list){
            System.out.println(r.toString());
        }
       System.out.println( list.removeFirst());*/
    }

}
